package com.sweetguy.result;

import lombok.Data;

import java.io.Serializable;

@Data
public class Result<T> implements Serializable {
    //
    private Integer code;
    //
    private String message;
    //
    private T data;

    //
    public Result() {
        this(ResultCode.SUCCESS.getCODE(), ResultCode.SUCCESS.getMESSAGE(), null);
    }

    public Result(T data) {
        this(ResultCode.SUCCESS.getCODE(), ResultCode.SUCCESS.getMESSAGE(), data);
    }

    //
    public Result(ResultCode resultCode) {
        this(resultCode.getCODE(), resultCode.getMESSAGE(), null);
    }

    //
    public Result(ResultCode resultCode, T data) {
        this(resultCode.getCODE(), resultCode.getMESSAGE(), data);
    }

    public Result(Integer code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }
}
